﻿using Jay.Sc2.Bof.Lib.State;

namespace Jay.Sc2.Bof.Lib.Action.Zerg
{
	class ActionProduceQueen : ActionProduceZerg
	{
		public static ActionProduceQueen Instance = new ActionProduceQueen();
		private ActionProduceQueen() : base(50, 150, 0, 2) { }
		public override int AvailableProducer(State.IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			return state.Hatchery.AvailableForUpgrade +
				state.Lair.AvailableForUpgrade +
				state.Hive.AvailableForUpgrade;
		}
		public override bool HaveTechnology(State.IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			return state.SpawningPool.Count > 0;
		}
		public override void Execute(IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			base.Execute(bo);
			state.Queen_Building++;
			bo.AddAction(state.Time + BuildTime, new ActionGeneric("ActionSpawnQueen", (ActionGeneric.ActionExecuteDelegate)delegate(IBuildOrder ibo)
			{
				ZergState ibostate = ibo.State as ZergState;
				state.Queen_Building--;
				state.Queen++;
				state.Queen_Energy.Add(50.0);
			}));
		}
		private IAction[,] m_Requirements;
		public override IAction[,] Requirements
		{
			get
			{
				if (m_Requirements == null)
					m_Requirements = new IAction[,] { { ActionProduceSpawningPool.Instance } };
				return m_Requirements;
			}
		}
	}
}
